/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME handler: Ethernet PMHD (24)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: Ethernet PMHD (24)
 */

#include "app_basic.h"
#ifndef OMCI_X86
#include "rtk/stat.h"
#endif

MIB_TABLE_INFO_T gMibGenexisEthPMHD4TableInfo;
MIB_ATTR_INFO_T  gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ATTR_NUM];
MIB_TABLE_GENEXIS_ETHPMHD4_T gMibGenexisEthPMHD4DefRow;
MIB_TABLE_OPER_T gMibGenexisEthPMHD4Oper;

static UINT8    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_ATTR_NUM];
static UINT8    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_ATTR_NUM];


GOS_ERROR_CODE MeGenexisPMHD4_CfgMe(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
    GOS_ERROR_CODE                  ret = GOS_OK;
    UINT32                          entrySize;
    MIB_TABLE_INDEX                 tableIndex;
    MIB_TABLE_ETHUNI_T              mibPptpEthUNI;
    MIB_TABLE_GENEXIS_ETHPMHD4_T               *pMibMeGenexisPMHD4;
    MIB_TABLE_GENEXIS_ETHPMHD4_T               mibCurrentBin;
    MIB_TABLE_ANIG_T                mibAniG;

    pMibMeGenexisPMHD4 = (MIB_TABLE_GENEXIS_ETHPMHD4_T *)pNewRow;
    tableIndex = MIB_TABLE_GENEXIS_ETHPMHD4_INDEX;
    entrySize = MIB_GetTableEntrySize(tableIndex);

    switch (operationType)
    {
        case MIB_ADD:
            if(pMibMeGenexisPMHD4->AssociateType == GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_PPTP_ETH_UNI)
            {
                mibPptpEthUNI.EntityID = pMibMeGenexisPMHD4->EntityId;
                // check if corresponding PPTP exists
                ret = MIB_Get(MIB_TABLE_ETHUNI_INDEX, &mibPptpEthUNI, MIB_GetTableEntrySize(MIB_TABLE_ETHUNI_INDEX));
                if (GOS_OK != ret)
                {
                    OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
                        __FUNCTION__, MIB_GetTableName(MIB_TABLE_ETHUNI_INDEX), mibPptpEthUNI.EntityID);
                    return GOS_FAIL;
                }
            }
            else
            {
                // check if corresponding ANI-G exists
                mibAniG.EntityID = pMibMeGenexisPMHD4->EntityId;
                ret = MIB_Get(MIB_TABLE_ANIG_INDEX, &mibAniG, sizeof(MIB_TABLE_ANIG_T));
                if (GOS_OK != ret)
                {
                    OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
                        __FUNCTION__, MIB_GetTableName(MIB_TABLE_ANIG_INDEX), mibAniG.EntityID);
                    return GOS_FAIL;
                }
            }
            
            // sync control block data from history bin to current bin
            if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, pMibMeGenexisPMHD4, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), pMibMeGenexisPMHD4->EntityId);
            }

            ret = mib_alarm_table_add(tableIndex, pNewRow);
            break;

        case MIB_DEL:
            ret = mib_alarm_table_del(tableIndex, pOldRow);
            break;

        case MIB_SET:
            mibCurrentBin.EntityId = pMibMeGenexisPMHD4->EntityId;
            if (GOS_OK != MIB_GetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Current bin not found in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), mibCurrentBin.EntityId);

                return GOS_FAIL;
            }

            // sync control block data from history bin to current bin
            mibCurrentBin.ThresholdID = pMibMeGenexisPMHD4->ThresholdID;
            if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), mibCurrentBin.EntityId);
            }
            break;

        default:
            break;
    }

	return ret;
}

GOS_ERROR_CODE genexispmhd4_pmhd_pm_handler(MIB_TABLE_INDEX         tableIndex,
                                        omci_me_instance_t      instanceID,
                                        omci_pm_oper_type_t     operType,
                                        BOOL                    *pIsTcaRaised)
{
    GOS_ERROR_CODE                  ret;
    UINT32                          entrySize;
    MIB_TABLE_GENEXIS_ETHPMHD4_T               mibMeGenexisPMHD4;
    MIB_TABLE_GENEXIS_ETHPMHD4_T               mibCurrentBin;
    MIB_TABLE_ETHUNI_T              mibPptpEthUNI;
    MIB_TABLE_ANIG_T                mibAniG;
    omci_port_stat_t                portCntrs;
    omci_port_stat_t                *pPortCntrs = (omci_port_stat_t*)&portCntrs;
    unsigned long long              tempCntr;
    
    if (!pIsTcaRaised)
        return GOS_ERR_PARAM;
    
    entrySize = MIB_GetTableEntrySize(tableIndex);
    
    mibMeGenexisPMHD4.EntityId = instanceID;
    if (GOS_OK != MIB_Get(tableIndex, &mibMeGenexisPMHD4, entrySize))
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        return GOS_FAIL;
    }
    
    mibCurrentBin.EntityId = instanceID;
    if (GOS_OK != MIB_GetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Current bin not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        return GOS_FAIL;
    }
    
    switch (mibMeGenexisPMHD4.AssociateType)
    {
        case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_PPTP_ETH_UNI:
            mibPptpEthUNI.EntityID = instanceID;
            // check if corresponding PPTP exists
            ret = MIB_Get(MIB_TABLE_ETHUNI_INDEX, &mibPptpEthUNI, MIB_GetTableEntrySize(MIB_TABLE_ETHUNI_INDEX));
            if (GOS_OK != ret)
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(MIB_TABLE_ETHUNI_INDEX), mibPptpEthUNI.EntityID);
                return GOS_FAIL;
            }
            break;
        case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_ANI:
            // check if corresponding ANI-G exists
            mibAniG.EntityID = instanceID;
            ret = MIB_Get(MIB_TABLE_ANIG_INDEX, &mibAniG, sizeof(MIB_TABLE_ANIG_T));
            if (GOS_OK != ret)
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(MIB_TABLE_ANIG_INDEX), mibAniG.EntityID);
                return GOS_FAIL;
            }
            break;
        default:
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "We don't support MeGenexisPMHD4 with type %d", mibMeGenexisPMHD4.AssociateType);
            return GOS_FAIL;
    }
    
    if (OMCI_PM_OPER_RESET == operType)
    {
        memset(&mibCurrentBin, 0, entrySize);
        mibCurrentBin.EntityId = instanceID;
        mibCurrentBin.ThresholdID = mibMeGenexisPMHD4.ThresholdID;
        
        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        if (GOS_OK != MIB_Set(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set instance error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        return GOS_OK;
    }
    
    if(OMCI_PM_OPER_GET_CURRENT_DATA == operType)
    {
        switch (mibMeGenexisPMHD4.AssociateType)
        {
            case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_PPTP_ETH_UNI:
                omci_pm_update_veip_eth_uni(OMCI_PM_OPER_GET_CURRENT_DATA);
                break;
            case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_ANI:
                omci_pm_update_pptp_eth_uni(OMCI_PM_OPER_GET_CURRENT_DATA);
                break;
            default:
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "We don't support MeGenexisPMHD4 with type %d", mibMeGenexisPMHD4.AssociateType);
        }
    }
    
    if (OMCI_PM_OPER_UPDATE == operType ||
        OMCI_PM_OPER_UPDATE_AND_SWAP == operType ||
        OMCI_PM_OPER_GET_CURRENT_DATA == operType)
    {
        // update PM values
        switch (mibMeGenexisPMHD4.AssociateType)
        {
            case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_PPTP_ETH_UNI:
                ret = omci_pm_getcurrent_pptp_eth_uni(instanceID,pPortCntrs);
                if (ret == GOS_OK)
                {
                    tempCntr = pPortCntrs->dot3StatsSymbolErrors +
                                pPortCntrs->etherStatsCRCAlignErrors;
                    m_omci_pm_update_accum_attr(tempCntr, mibCurrentBin.ReceivedError);
                    
                    m_omci_pm_update_accum_attr(pPortCntrs->ifOutDiscards, mibCurrentBin.TransmittedDiscard);
                    m_omci_pm_update_accum_attr(pPortCntrs->dot1dTpPortInDiscards, mibCurrentBin.ReceivedDiscard);
                    
                    m_omci_pm_update_accum_attr(pPortCntrs->ifOutOctets, mibCurrentBin.TransmittedOctets);
                    m_omci_pm_update_accum_attr(pPortCntrs->ifInOctets, mibCurrentBin.ReceivedOctets);
                }
                break;
            case GENEXIS_ETHPMHD4_ASSOCIATETYPE_TYPE_ANI:
                ret = omci_pm_getcurrent_veip_eth_uni(instanceID,pPortCntrs);
                if (ret == GOS_OK)
                {
                    tempCntr = pPortCntrs->dot3StatsSymbolErrors +
                                pPortCntrs->etherStatsCRCAlignErrors;
                    m_omci_pm_update_accum_attr(tempCntr, mibCurrentBin.TransmittedError);
                    
                    m_omci_pm_update_accum_attr(pPortCntrs->dot1dTpPortInDiscards, mibCurrentBin.TransmittedDiscard);
                    m_omci_pm_update_accum_attr(pPortCntrs->ifOutDiscards, mibCurrentBin.ReceivedDiscard);
                    
                    m_omci_pm_update_accum_attr(pPortCntrs->ifInOctets, mibCurrentBin.TransmittedOctets);
                    m_omci_pm_update_accum_attr(pPortCntrs->ifOutOctets, mibCurrentBin.ReceivedOctets);
                }
                break;
            default:
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "We don't support MeGenexisPMHD4 with type %d", mibMeGenexisPMHD4.AssociateType);
        }
        
        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
        
        ret = omci_pm_is_threshold_crossed(tableIndex, instanceID,
                &mibCurrentBin, aTcaAlmNumber, aTcaAttrMap, NULL, pIsTcaRaised);
        if (GOS_OK != ret && GOS_ERR_NOT_FOUND != ret)
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Check threshold error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
    }
    
    if (OMCI_PM_OPER_SWAP == operType || OMCI_PM_OPER_UPDATE_AND_SWAP == operType)
    {
        // swap PM values
        mibCurrentBin.IntEndTime++;
        mibMeGenexisPMHD4.IntEndTime = mibCurrentBin.IntEndTime;
        
        if (GOS_OK != MIB_Set(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set instance error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
        
        memset(&mibCurrentBin, 0, entrySize);
        mibCurrentBin.EntityId = instanceID;
        mibCurrentBin.ThresholdID = mibMeGenexisPMHD4.ThresholdID;
        mibCurrentBin.IntEndTime = mibMeGenexisPMHD4.IntEndTime;
        
        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
    }
    
    return GOS_OK;
}

GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    UINT8 isIgnore = 0;
    if(GOS_OK == omci_ignore_mib_table_check(OMCI_ME_CLASS_GENEXIS_ETHPMHD4, OMCI_ME_CLASS_SUB_255_GENEXIS_ETHPMHD4, &isIgnore))
    {
        if(isIgnore)
        {
	        OMCI_PRINT("Ignore classId:%d", OMCI_ME_CLASS_GENEXIS_ETHPMHD4);
            return GOS_FAIL;
        }

    }
    gMibGenexisEthPMHD4TableInfo.Name = "GENEXIS ETHPMHD4";
    gMibGenexisEthPMHD4TableInfo.ShortName = "GENEXIS ETHPMHD4";
    gMibGenexisEthPMHD4TableInfo.Desc = "GENEXIS ETHPMHD4";
    gMibGenexisEthPMHD4TableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_GENEXIS_ETHPMHD4);
    gMibGenexisEthPMHD4TableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibGenexisEthPMHD4TableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD_PM);
    gMibGenexisEthPMHD4TableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET | OMCI_ME_ACTION_GET_CURRENT_DATA);
    gMibGenexisEthPMHD4TableInfo.pAttributes = &(gMibGenexisEthPMHD4AttrInfo[0]);

	gMibGenexisEthPMHD4TableInfo.attrNum = MIB_TABLE_GENEXIS_ETHPMHD4_ATTR_NUM;
	gMibGenexisEthPMHD4TableInfo.entrySize = sizeof(MIB_TABLE_GENEXIS_ETHPMHD4_T);
	gMibGenexisEthPMHD4TableInfo.pDefaultRow = &gMibGenexisEthPMHD4DefRow;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "IntEndTime";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdID";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].Name = "AssociateType";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TransmittedTraffic";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReceivedTraffic";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TransmittedRate";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReceivedRate";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TransmittedOctets";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReceivedOctets";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TransmittedDiscard";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReceivedDiscard";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TransmittedError";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ReceivedError";

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Interval End Time";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Threshold Data ID";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "AssociateType";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TransmittedTraffic";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ReceivedTraffic";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TransmittedRate";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ReceivedRate";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TransmittedOctets";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ReceivedOctets";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TransmittedDiscard";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ReceivedDiscard";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TransmittedError";
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "ReceivedError";

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibGenexisEthPMHD4AttrInfo[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);

    memset(&gMibGenexisEthPMHD4DefRow, 0x00, sizeof(gMibGenexisEthPMHD4DefRow));

    memset(&gMibGenexisEthPMHD4Oper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibGenexisEthPMHD4Oper.meOperDrvCfg = MeGenexisPMHD4_CfgMe;
    gMibGenexisEthPMHD4Oper.meOperConnCheck = NULL;
	gMibGenexisEthPMHD4Oper.meOperConnCfg = NULL;
	gMibGenexisEthPMHD4Oper.meOperAvlTreeAdd = NULL;
    gMibGenexisEthPMHD4Oper.meOperDump = omci_mib_oper_dump_default_handler;
    gMibGenexisEthPMHD4Oper.meOperPmHandler = genexispmhd4_pmhd_pm_handler;

    // for PM ME only, indicates the Threshold value attribute mapping and alarm number
    memset(aTcaAlmNumber, 0, sizeof(aTcaAlmNumber));
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX] = 0;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX] = 1;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX] = 2;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX] = 3;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX] = 4;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX] = 5;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX] = 6;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX] = 7;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX] = 8;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX] = 9;
    aTcaAlmNumber[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX] = 10;
    memset(aTcaAttrMap, 0, sizeof(aTcaAttrMap));
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_ASSOCIATE_TYPE_INDEX - MIB_TABLE_FIRST_INDEX] = 1;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_TX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX] = 2;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_RX_TRAFFIC_INDEX - MIB_TABLE_FIRST_INDEX] = 3;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_TX_RATE_INDEX - MIB_TABLE_FIRST_INDEX] = 4;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_RX_RATE_INDEX - MIB_TABLE_FIRST_INDEX] = 5;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_TX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX] = 6;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_RX_OCTETS_INDEX - MIB_TABLE_FIRST_INDEX] = 7;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_TX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX] = 8;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_RX_DISCARD_INDEX - MIB_TABLE_FIRST_INDEX] = 9;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_TX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX] = 10;
    aTcaAttrMap[MIB_TABLE_GENEXIS_ETHPMHD4_RX_ERROR_INDEX - MIB_TABLE_FIRST_INDEX] = 11;

    MIB_TABLE_GENEXIS_ETHPMHD4_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibGenexisEthPMHD4TableInfo, &gMibGenexisEthPMHD4Oper);

    return GOS_OK;
}
